package cn.gemiman.daoyi.module.cms.dal.mysql.articledetailreadlogs;

import java.util.*;

import cn.gemiman.daoyi.framework.common.pojo.PageResult;
import cn.gemiman.daoyi.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gemiman.daoyi.framework.mybatis.core.mapper.BaseMapperX;
import cn.gemiman.daoyi.module.cms.dal.dataobject.articledetailreadlogs.ArticleDetailReadLogsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.gemiman.daoyi.module.cms.controller.admin.articledetailreadlogs.vo.*;

/**
 * 阅读记录 Mapper
 *
 * @author 道一源码
 */
@Mapper
public interface ArticleDetailReadLogsMapper extends BaseMapperX<ArticleDetailReadLogsDO> {

    default PageResult<ArticleDetailReadLogsDO> selectPage(ArticleDetailReadLogsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ArticleDetailReadLogsDO>()
                .eqIfPresent(ArticleDetailReadLogsDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(ArticleDetailReadLogsDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(ArticleDetailReadLogsDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(ArticleDetailReadLogsDO::getEndTime, reqVO.getEndTime())
                .betweenIfPresent(ArticleDetailReadLogsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ArticleDetailReadLogsDO::getId));
    }

}